<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    

</body>
<script>
var arr  = [2,5,6,1,0,9,4,7,8,3];
var min;  
var k;
var temp;

for (var i = 0;i<10;i++) {
    min = arr[i];
    k = i;
    for (var j = i+1;j<10;j++) {
        if (min > arr[j]) {
            min = arr[j];
            k = j;
        }
    }
    temp = arr[i];
    arr[i] = arr[k];
    arr[k] = temp;
}
document.write(arr);
</script>

</html>